import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'
import Home from '../views/Home.vue'
import Index from '@/views/platform/Index/index.vue'
import userlist from '@/views/platform/User/userlist.vue'
import Admin from '@/views/platform/User/admin.vue'
import Addlist from '@/views/platform/commodity/addlist.vue'
import Goods from '@/views/platform/commodity/Goods.vue'
import Journalism from '@/views/platform/Journalism/Journalism.vue'
import Notice from '@/views/platform/Journalism/Notice.vue'

const routes = [
  {
    path: '/',
    name: 'login',
    component: Login,
  },
  {
    path: '/index',
    name: 'index',
    component: Home,
    redirect: '/index',
    children: [
      {
        path: '/index',
        name: 'index',
        component: Index,
      },
      {
        path: '/userlist',
        name: 'userlist',
        component: userlist,
      },
      {
        path: '/admin',
        name: 'admin',
        component: Admin,
      },
      {
        path: '/addlist',
        name: 'addlist',
        component: Addlist,
      },
     
      {
        path: '/goods',
        name: 'goods',
        component: Goods,
      },
      {
        path: '/Journalism',
        name: 'Journalism',
        component: Journalism,
      },
      {
        path: '/Notice',
        name: 'Notice',
        component: Notice,
      },
    ],
  },

  // {
  //   path: '/goods',
  //   name: 'goods',
  //   component: Goods,
  // },
  //放在最下面, 将匹配所有内容并将其放在 `$route.params.pathMatch` 下
  // {
  // 	path: '/:pathMatch(.*)*',
  // 	component: NotFound,
  // },
]

const router = createRouter({
  // history: createWebHistory(process.env.NODE_ENV === 'production'? './webadmin': './'), 配置子目录
  history: createWebHistory(),
  routes,
})

export default router
